#{extends 'main.html' /}
#{set title:'Livres' /}

<div class="form">
	
		<span class="bigtitle">Livres</span>

	    <div id="cmd_add"
			class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-primary">
			<span class="ui-button-icon-primary ui-icon ui-icon-plus"></span>
		</div>
	    
	    #{paginate.controls items:list /} 
	    #{paginate.summary items:list /}
	    <table class="table_gridview">
		    <tr>
		    	<th>Série</th>
		    	<th>Titre</th>
		    	<th>Auteur</th>
		    	<th>Editeur</th>
		    	<th>Année de parution</th>
		    </tr>
		    #{paginate.list items:list, as:'book'} 
	    		<tr class="${book_parity}">
	    			<td>
	    			#{if book.collection != null}
	    				<a href="@{collectionmngt.bookincollection(book.collection.id)}">
	    					${book.collection.title}
	    				</a>
	    			#{/if}
	    			</td>
	    			<td>
	    				<a href="@{bookmngt.displayone(book.id)}">
	    					${book.title}
	    				</a>
	    			</td>
	    			<td>
	    				<a href="@{author.displaylist(book.author.id)}">
	    					${book.author.firstname} ${book.author.name}
	    				</a>
	    			</td>
	    			<td>#{if book.publisher != null}${book.publisher.firstname} ${book.publisher.name}#{/if}</td>
	    			<td>${book.year}</td>
	    		</tr>
		    #{/paginate.list}
		</table>
	    #{else}
	      Empty list!
	    #{/else}
	    
</div>

<script language="javascript" type="text/javascript">
$(document).ready(function(){

	$("#cmd_add").click(function() {
		window.location = '@{bookmngt.addform}'
	});

});
</script>
	    